﻿namespace Main.lib.util
{

    public sealed class BigArray<T>
    {

        public readonly T[][] Data;
        public readonly ulong Size;

        public BigArray(ulong NewSize)
        {
            Size = NewSize;
            Data = new T[(byte)(Size / int.MaxValue + 1)][];
            for (byte i = 0; i < Data.Length; i++)
                if (i == (Data.Length - 1))
                    Data[i] = new T[(int)NewSize];
                else
                {
                    Data[i] = new T[int.MaxValue];
                    NewSize -= int.MaxValue;
                }
        }

        public T this[ulong Index]
        {
            get
            {
                return Data[Index / int.MaxValue][Index % int.MaxValue];
            }
            set
            {
                Data[Index / int.MaxValue][Index % int.MaxValue] = value;
            }
        }

    }

}